import Vue from 'vue'
import VueRouter from 'vue-router'
//import { getToken } from '@/api/login'
import home from '@/views/home/index.vue'
Vue.use(VueRouter)

const routes = [
    { path: '/', redirect: '/login' },
    { path: '/login', component: () =>
            import ('../views/login/login.vue') },
    {
        path: '/home',
        component: home,
        children: [
            { path: '/home', redirect: '/jys' },
            {path:'/jys',component:()=>import('@/views/home/components/home2/home2-1/homejys.vue')},
            { path: '/home-1-1', component: () =>
                    import ('../views/home/components/home1/home-1-1.vue') },
            { path: '/home-2-1-1', component: () =>
                    import ('../views/home/components/home2/home2-1/home-2-1-1.vue') },
            { path: '/home-2-1-2', component: () =>
                    import ('../views/home/components/home2/home2-1/home-2-1-2.vue') },
            { path: '/home-2-1-3', component: () =>
                    import ('../views/home/components/home2/home2-1/home-2-1-3.vue') },
            { path: '/xuesheng', component: () =>
                    import ('../views/home/components/home2/home2-1/home-2-1-4.vue') },
            { path: '/banji', component: () =>
                    import ('../views/home/components/home2/home2-2/home-2-2-1.vue') },
            { path: '/kecheng', component: () =>
                    import ('../views/home/components/home2/home2-2/home-2-2-2.vue') },
            { path: '/home-3-1', component: () =>
                    import ('../views/home/components/home3/home-3-1.vue') },
            { path: '/home-3-2', component: () =>
                    import ('../views/home/components/home3/home-3-2.vue') },
        ]
    }
]

const router = new VueRouter({
        routes
    })
    //配置路由导航
    //router.beforeEach((to,from,next)=>{
    // if(to.path==='/login'){
    //   return next()
    // }
    // const token=getToken()
    // if(token!=null) {
    // console.log(token);
    // router.push('/home')
    //   return next('/home')
    // }else{
    // router.push('/login')
    //     return next('/login')
    //   }
    // })
export default router